import { Service } from "cl-admin";
import BaseService from "@/service/base";
@Service("clue")
class Clue extends BaseService {
	/**
	 * 待接单列表
	 */
	receivedList({ size, ...args }) {
		let params = {
			...args,
			pageSize: size
		};
		return this.$get("/listscus", { params }).then(res => {
			return {
				list: res.lists.map(v => ({
					...v,
					region: [v.province, v.city, v.area],
					rel_place: [v.new_province, v.new_city, v.new_area].join("/")
				})),
				pagination: {
					...params,
					size,
					total: res.total
				}
			};
		});
	}

	// 接单
	receiving(params) {
		return this.$post("/receivecus", params);
	}

	// 已领取列表
	missedList({ size, bra_id = [], ...args }) {
		let params = {
			...args,
			pageSize: size,
			bra_id: bra_id.join()

		};
		return this.$get("/receivedlist", { params }).then(res => {
			return {
				list: res.lists.map(v => ({
					...v,
					region: [v.province, v.city, v.area],
					rel_place: [v.new_province, v.new_city, v.new_area].join("/")
				})),
				pagination: {
					...params,
					size,
					total: res.total
				}
			};
		});
	}

	// 派单流失
	runoff(clue_cus_id) {
		return this.$post("/runoff", { clue_cus_id });
	}

	refund(params) {
		return this.$post("/applyrefund", params);
	}

	//获取虚拟电话号码
	getVmphone(params) {
		return this.$get("/getPhone", { params })
	}
}
export default Clue;
